package cn.blackhole.simple.domain.exception.service.impl;

import cn.blackhole.simple.common.enums.InterfaceType;
import cn.blackhole.simple.domain.exception.service.ExceptionHandler;

public class LoggingExceptionHandler implements ExceptionHandler {

    private final int attempt;

    public LoggingExceptionHandler(int attempt) {
        super();
        this.attempt = attempt;
    }

    @Override
    public boolean handleException(Throwable ex, InterfaceType type) {
        System.err.printf("Attempt %d failed for %s: %s%n", attempt, type, ex.getMessage());
        return true; // 继续重试
    }

}